module denqueueUpdateMuxer32 (
    input wire clk,
    input wire rst,
    input wire dequeue_head_new_en_1,
    input wire dequeue_head_new_en_2,
    input wire dequeue_head_new_en_3,
    input wire dequeue_head_new_en_4,
    input wire dequeue_head_new_en_5,
    input wire dequeue_head_new_en_6,
    input wire dequeue_head_new_en_7,
    input wire dequeue_head_new_en_8,
    input wire dequeue_head_new_en_9,
    input wire dequeue_head_new_en_10,
    input wire dequeue_head_new_en_11,
    input wire dequeue_head_new_en_12,
    input wire dequeue_head_new_en_13,
    input wire dequeue_head_new_en_14,
    input wire dequeue_head_new_en_15,
    input wire dequeue_head_new_en_16,
    input wire dequeue_head_new_en_17,
    input wire dequeue_head_new_en_18,
    input wire dequeue_head_new_en_19,
    input wire dequeue_head_new_en_20,
    input wire dequeue_head_new_en_21,
    input wire dequeue_head_new_en_22,
    input wire dequeue_head_new_en_23,
    input wire dequeue_head_new_en_24,
    input wire dequeue_head_new_en_25,
    input wire dequeue_head_new_en_26,
    input wire dequeue_head_new_en_27,
    input wire dequeue_head_new_en_28,
    input wire dequeue_head_new_en_29,
    input wire dequeue_head_new_en_30,
    input wire dequeue_head_new_en_31,
    input wire dequeue_head_new_en_32,
    input wire [5:0] dequeue_head_new_priority_1,
    input wire [5:0] dequeue_head_new_priority_2,
    input wire [5:0] dequeue_head_new_priority_3,
    input wire [5:0] dequeue_head_new_priority_4,
    input wire [5:0] dequeue_head_new_priority_5,
    input wire [5:0] dequeue_head_new_priority_6,
    input wire [5:0] dequeue_head_new_priority_7,
    input wire [5:0] dequeue_head_new_priority_8,
    input wire [5:0] dequeue_head_new_priority_9,
    input wire [5:0] dequeue_head_new_priority_10,
    input wire [5:0] dequeue_head_new_priority_11,
    input wire [5:0] dequeue_head_new_priority_12,
    input wire [5:0] dequeue_head_new_priority_13,
    input wire [5:0] dequeue_head_new_priority_14,
    input wire [5:0] dequeue_head_new_priority_15,
    input wire [5:0] dequeue_head_new_priority_16,
    input wire [5:0] dequeue_head_new_priority_17,
    input wire [5:0] dequeue_head_new_priority_18,
    input wire [5:0] dequeue_head_new_priority_19,
    input wire [5:0] dequeue_head_new_priority_20,
    input wire [5:0] dequeue_head_new_priority_21,
    input wire [5:0] dequeue_head_new_priority_22,
    input wire [5:0] dequeue_head_new_priority_23,
    input wire [5:0] dequeue_head_new_priority_24,
    input wire [5:0] dequeue_head_new_priority_25,
    input wire [5:0] dequeue_head_new_priority_26,
    input wire [5:0] dequeue_head_new_priority_27,
    input wire [5:0] dequeue_head_new_priority_28,
    input wire [5:0] dequeue_head_new_priority_29,
    input wire [5:0] dequeue_head_new_priority_30,
    input wire [5:0] dequeue_head_new_priority_31,
    input wire [5:0] dequeue_head_new_priority_32,
    input wire [15:0]  dequeue_head_new_value_1,
    input wire [15:0]  dequeue_head_new_value_2,
    input wire [15:0]  dequeue_head_new_value_3,
    input wire [15:0]  dequeue_head_new_value_4,
    input wire [15:0]  dequeue_head_new_value_5,
    input wire [15:0]  dequeue_head_new_value_6,
    input wire [15:0]  dequeue_head_new_value_7,
    input wire [15:0]  dequeue_head_new_value_8,
    input wire [15:0]  dequeue_head_new_value_9,
    input wire [15:0]  dequeue_head_new_value_10,
    input wire [15:0]  dequeue_head_new_value_11,
    input wire [15:0]  dequeue_head_new_value_12,
    input wire [15:0]  dequeue_head_new_value_13,
    input wire [15:0]  dequeue_head_new_value_14,
    input wire [15:0]  dequeue_head_new_value_15,
    input wire [15:0]  dequeue_head_new_value_16,
    input wire [15:0]  dequeue_head_new_value_17,
    input wire [15:0]  dequeue_head_new_value_18,
    input wire [15:0]  dequeue_head_new_value_19,
    input wire [15:0]  dequeue_head_new_value_20,
    input wire [15:0]  dequeue_head_new_value_21,
    input wire [15:0]  dequeue_head_new_value_22,
    input wire [15:0]  dequeue_head_new_value_23,
    input wire [15:0]  dequeue_head_new_value_24,
    input wire [15:0]  dequeue_head_new_value_25,
    input wire [15:0]  dequeue_head_new_value_26,
    input wire [15:0]  dequeue_head_new_value_27,
    input wire [15:0]  dequeue_head_new_value_28,
    input wire [15:0]  dequeue_head_new_value_29,
    input wire [15:0]  dequeue_head_new_value_30,
    input wire [15:0]  dequeue_head_new_value_31,
    input wire [15:0]  dequeue_head_new_value_32,
    output reg dequeue_head_new_en,
    output reg [5:0] dequeue_head_new_priority,
    output reg [15:0] dequeue_head_new_value
);
    wire [7:0] arbitration_group [0:3];
    wire [3:0] dequeue_head_new_en_part;
    wire [5:0] dequeue_head_new_priority_part [0:3];
    wire [15:0] dequeue_head_new_value_part [0:3];

    wire [3:0] final_arbitration;

    always @(posedge clk) begin
        if (rst) begin
            dequeue_head_new_en <= 1'b0;
            dequeue_head_new_priority <= 0;
        end
        else begin
            if (final_arbitration == 4'b0001) begin
                dequeue_head_new_en <= 1'b1;
                dequeue_head_new_priority <= dequeue_head_new_priority_part[0];
                dequeue_head_new_value <= dequeue_head_new_value_part[0];
            end

            if (final_arbitration == 4'b0010) begin
                dequeue_head_new_en <= 1'b1;
                dequeue_head_new_priority <= dequeue_head_new_priority_part[1];
                dequeue_head_new_value <= dequeue_head_new_value_part[1];
            end

            if (final_arbitration == 4'b0100) begin
                dequeue_head_new_en <= 1'b1;
                dequeue_head_new_priority <= dequeue_head_new_priority_part[2];
                dequeue_head_new_value <= dequeue_head_new_value_part[2];
            end

            if (final_arbitration == 4'b1000) begin
                dequeue_head_new_en <= 1'b1;
                dequeue_head_new_priority <= dequeue_head_new_priority_part[3];
                dequeue_head_new_value <= dequeue_head_new_value_part[3];
            end

            if (final_arbitration == 4'b0000) begin
                dequeue_head_new_en <= 1'b0;
            end
        end
    end

    //denqueueUpdateArbiter4
    denqueueUpdateMuxer8 mux1(.clk(clk), .rst(rst), 
                            .dequeue_head_new_en_1(dequeue_head_new_en_1), .dequeue_head_new_en_2(dequeue_head_new_en_2), .dequeue_head_new_en_3(dequeue_head_new_en_3), .dequeue_head_new_en_4(dequeue_head_new_en_4), .dequeue_head_new_en_5(dequeue_head_new_en_5), .dequeue_head_new_en_6(dequeue_head_new_en_6), .dequeue_head_new_en_7(dequeue_head_new_en_7), .dequeue_head_new_en_8(dequeue_head_new_en_8), 
                            .dequeue_head_new_priority_1(dequeue_head_new_priority_1), .dequeue_head_new_priority_2(dequeue_head_new_priority_2), .dequeue_head_new_priority_3(dequeue_head_new_priority_3), .dequeue_head_new_priority_4(dequeue_head_new_priority_4), .dequeue_head_new_priority_5(dequeue_head_new_priority_5), .dequeue_head_new_priority_6(dequeue_head_new_priority_6), .dequeue_head_new_priority_7(dequeue_head_new_priority_7), .dequeue_head_new_priority_8(dequeue_head_new_priority_8), 
                            .dequeue_head_new_value_1(dequeue_head_new_value_1), .dequeue_head_new_value_2(dequeue_head_new_value_2), .dequeue_head_new_value_3(dequeue_head_new_value_3), .dequeue_head_new_value_4(dequeue_head_new_value_4), .dequeue_head_new_value_5(dequeue_head_new_value_5), .dequeue_head_new_value_6(dequeue_head_new_value_6), .dequeue_head_new_value_7(dequeue_head_new_value_7), .dequeue_head_new_value_8(dequeue_head_new_value_8), 
                            .enqueue_arbitration(arbitration_group[0]), .dequeue_head_new_en(dequeue_head_new_en_part[0]), .dequeue_head_new_priority(dequeue_head_new_priority_part[0]), .dequeue_head_new_value(dequeue_head_new_value_part[0]));

    denqueueUpdateMuxer8 mux2(.clk(clk), .rst(rst), 
                            .dequeue_head_new_en_1(dequeue_head_new_en_9), .dequeue_head_new_en_2(dequeue_head_new_en_10), .dequeue_head_new_en_3(dequeue_head_new_en_11), .dequeue_head_new_en_4(dequeue_head_new_en_12), .dequeue_head_new_en_5(dequeue_head_new_en_13), .dequeue_head_new_en_6(dequeue_head_new_en_14), .dequeue_head_new_en_7(dequeue_head_new_en_15), .dequeue_head_new_en_8(dequeue_head_new_en_16), 
                            .dequeue_head_new_priority_1(dequeue_head_new_priority_9), .dequeue_head_new_priority_2(dequeue_head_new_priority_10), .dequeue_head_new_priority_3(dequeue_head_new_priority_11), .dequeue_head_new_priority_4(dequeue_head_new_priority_12), .dequeue_head_new_priority_5(dequeue_head_new_priority_13), .dequeue_head_new_priority_6(dequeue_head_new_priority_14), .dequeue_head_new_priority_7(dequeue_head_new_priority_15), .dequeue_head_new_priority_8(dequeue_head_new_priority_16), 
                            .dequeue_head_new_value_1(dequeue_head_new_value_9), .dequeue_head_new_value_2(dequeue_head_new_value_10), .dequeue_head_new_value_3(dequeue_head_new_value_11), .dequeue_head_new_value_4(dequeue_head_new_value_12), .dequeue_head_new_value_5(dequeue_head_new_value_13), .dequeue_head_new_value_6(dequeue_head_new_value_14), .dequeue_head_new_value_7(dequeue_head_new_value_15), .dequeue_head_new_value_8(dequeue_head_new_value_16), 
                            .enqueue_arbitration(arbitration_group[1]), .dequeue_head_new_en(dequeue_head_new_en_part[1]), .dequeue_head_new_priority(dequeue_head_new_priority_part[1]), .dequeue_head_new_value(dequeue_head_new_value_part[1]));

    denqueueUpdateMuxer8 mux3(.clk(clk), .rst(rst), 
                            .dequeue_head_new_en_1(dequeue_head_new_en_17), .dequeue_head_new_en_2(dequeue_head_new_en_18), .dequeue_head_new_en_3(dequeue_head_new_en_19), .dequeue_head_new_en_4(dequeue_head_new_en_20), .dequeue_head_new_en_5(dequeue_head_new_en_21), .dequeue_head_new_en_6(dequeue_head_new_en_22), .dequeue_head_new_en_7(dequeue_head_new_en_23), .dequeue_head_new_en_8(dequeue_head_new_en_24), 
                            .dequeue_head_new_priority_1(dequeue_head_new_priority_17), .dequeue_head_new_priority_2(dequeue_head_new_priority_18), .dequeue_head_new_priority_3(dequeue_head_new_priority_19), .dequeue_head_new_priority_4(dequeue_head_new_priority_20), .dequeue_head_new_priority_5(dequeue_head_new_priority_21), .dequeue_head_new_priority_6(dequeue_head_new_priority_22), .dequeue_head_new_priority_7(dequeue_head_new_priority_23), .dequeue_head_new_priority_8(dequeue_head_new_priority_24), 
                            .dequeue_head_new_value_1(dequeue_head_new_value_17), .dequeue_head_new_value_2(dequeue_head_new_value_18), .dequeue_head_new_value_3(dequeue_head_new_value_19), .dequeue_head_new_value_4(dequeue_head_new_value_20), .dequeue_head_new_value_5(dequeue_head_new_value_21), .dequeue_head_new_value_6(dequeue_head_new_value_22), .dequeue_head_new_value_7(dequeue_head_new_value_23), .dequeue_head_new_value_8(dequeue_head_new_value_24), 
                            .enqueue_arbitration(arbitration_group[2]), .dequeue_head_new_en(dequeue_head_new_en_part[2]), .dequeue_head_new_priority(dequeue_head_new_priority_part[2]), .dequeue_head_new_value(dequeue_head_new_value_part[2]));

    denqueueUpdateMuxer8 mux4(.clk(clk), .rst(rst), 
                            .dequeue_head_new_en_1(dequeue_head_new_en_25), .dequeue_head_new_en_2(dequeue_head_new_en_26), .dequeue_head_new_en_3(dequeue_head_new_en_27), .dequeue_head_new_en_4(dequeue_head_new_en_28), .dequeue_head_new_en_5(dequeue_head_new_en_29), .dequeue_head_new_en_6(dequeue_head_new_en_30), .dequeue_head_new_en_7(dequeue_head_new_en_31), .dequeue_head_new_en_8(dequeue_head_new_en_32), 
                            .dequeue_head_new_priority_1(dequeue_head_new_priority_25), .dequeue_head_new_priority_2(dequeue_head_new_priority_26), .dequeue_head_new_priority_3(dequeue_head_new_priority_27), .dequeue_head_new_priority_4(dequeue_head_new_priority_28), .dequeue_head_new_priority_5(dequeue_head_new_priority_29), .dequeue_head_new_priority_6(dequeue_head_new_priority_30), .dequeue_head_new_priority_7(dequeue_head_new_priority_31), .dequeue_head_new_priority_8(dequeue_head_new_priority_32), 
                            .dequeue_head_new_value_1(dequeue_head_new_value_25), .dequeue_head_new_value_2(dequeue_head_new_value_26), .dequeue_head_new_value_3(dequeue_head_new_value_27), .dequeue_head_new_value_4(dequeue_head_new_value_28), .dequeue_head_new_value_5(dequeue_head_new_value_29), .dequeue_head_new_value_6(dequeue_head_new_value_30), .dequeue_head_new_value_7(dequeue_head_new_value_31), .dequeue_head_new_value_8(dequeue_head_new_value_32), 
                            .enqueue_arbitration(arbitration_group[3]), .dequeue_head_new_en(dequeue_head_new_en_part[3]), .dequeue_head_new_priority(dequeue_head_new_priority_part[3]), .dequeue_head_new_value(dequeue_head_new_value_part[3]));

    //第二层仲裁器
    denqueueUpdateArbiter4 arb(.dequeue_head_new_en_1(dequeue_head_new_en_part[0]), .dequeue_head_new_en_2(dequeue_head_new_en_part[1]), .dequeue_head_new_en_3(dequeue_head_new_en_part[2]), .dequeue_head_new_en_4(dequeue_head_new_en_part[3]), 
                            .dequeue_head_new_priority_1(dequeue_head_new_priority_part[0]), .dequeue_head_new_priority_2(dequeue_head_new_priority_part[1]), .dequeue_head_new_priority_3(dequeue_head_new_priority_part[2]), .dequeue_head_new_priority_4(dequeue_head_new_priority_part[3]), .queue_arbitration(final_arbitration));

endmodule